<#include "../common/layout/__mainlayout.html">
<#include "../common/__pagination.html">

<#assign pageBreadCrumbs>
    <li class="active"><a href="#">系统管理</a></li>
    <li class="active">菜单资源</li>
</#assign>

<#assign pageCss>
    <link href="${ctx}/static/admin/assets/treeTable/themes/vsStyle/treeTable.min.css" rel="stylesheet" type="text/css" />
    <link rel="stylesheet" href="${ctx}/static/admin/assets/css/zTreeStyle/zTreeStyle.css" type="text/css">
</#assign>

<#assign pageJavascript>
    <script src="${ctx}/static/admin/assets/treeTable/jquery.treeTable.min.js" type="text/javascript"></script>
    <script type="text/javascript">
        $(document).ready(function(){
            $("#contentTable").treeTable({expandLevel : 3});

            $('[data-rel=tooltip]').tooltip();

            if(!ace.vars['touch']) {
                $('.chosen-select').chosen({allow_single_deselect:true});
            }

            // 清除远程modal数据
            $("#editModal").on("hidden.bs.modal", function(){
                $(this).removeData("bs.modal");
            });
        });
    </script>
</#assign>

<@mainlayout pageBreadCrumbs=pageBreadCrumbs pageCss=pageCss pageJavascript=pageJavascript currentMenu="systemFlag-menurescFlag">
    <div class="row">
        <div class="widget-box widget-color-blue">
            <div class="widget-header widget-header-small">
                <h5 class="widget-title">资源管理列表</h5>
                <div class="widget-toolbar">
                    <a href="${ctx}/menures/view.do" data-rel="tooltip" title="添加" data-toggle="modal" data-target="#editModal"> <i class="ace-icon fa fa-plus-circle green"></i></a>
                    <a href="#" data-action="collapse"> <i class="ace-icon fa fa-chevron-up"></i></a>
                </div>
            </div>

            <div class="widget-body">
                <div class="widget-main no-padding">
                    <form id="searchForm" class="form-search form-inline" action="/menures/menuresList.do">


                    <table id="contentTable" class="table table-striped table-bordered table-hover">
                        <thead>
                        <tr>
                            <th width="120">资源名称</th>
                            <th width="50">权限名</th>
                            <!--
                            <th width="40">资源类型</th>
                            <th width="40">资源目标</th>
                            -->
                            <th width="40">排序</th>
                            <th width="40">状态</th>
                            <th width="60">更新时间</th>
                            <th width="120">备注</th>
                            <th width="60">操作</th>
                        </tr>
                        </thead>
                        <tbody>
                        <#list resourcePage.listData as resource>
                            <tr id="${resource.id}" <#if resource.pid??>pId="${resource.pid}"</#if>>
                                <td>${resource.name!}</td>
                                <td>${resource.permission!}</td>
                                <!--
                                <td>${resource.url!}</td>
                                <td><#if resource.type == 0> <div>菜单权限</div> <#else> <div style="color:red">资源权限</div></#if></td>
                                <td>${resource.target!}</td>
                                 -->
                                <td>${resource.sort!}</td>
                                <td><#if resource.enable == 0> <div>启用</div> <#else> <div style="color:red">停用</div></#if></td>
                                <td>${resource.updateTime?string("yyyy-MM-dd HH:mm:ss")!}</td>
                                <td>${resource.remark!}</td>
                                <td>
                                    <div class="hidden-sm hidden-xs action-buttons">
                                        <a class="green tooltip-success edit" href="${ctx}/menures/view.do?resourceId=${resource.id!}" data-rel="tooltip" title="编辑" data-toggle="modal" data-target="#editModal"><span class="label label-success">编辑</span></a>
                                    </div>
                                </td>
                            </tr>
                        </#list>

                        </tbody>
                    </table>
                    <@pagination resourcePage!/>
                    </form>
                </div>
            </div>
        </div>
    </div>

    <!--编辑对话框-->
    <div id="editModal" class="modal fade">
        <div class="modal-dialog">
            <div class="modal-content">
            </div>
        </div>
    </div>
</@mainlayout>